package cn.review;

public class TestFor2 {
    public static void main(String[] args) {
        f1();//调用打印举行的方法
        f2();//调用左直角三角形的方法
        f3();//打印99乘法表的方法
    }

    private static void f3() {
        for (int i = 1; i <= 9; i++) {
            for (int j = 1; j <= i; j++) {
                System.out.print(i + "*" + j + "=" + i * j + "\t");
            }
            System.out.println();
        }
        for (int i = 1; i <= 9; i++) {
            for (int j = 1; j <= 9; j++) {
                if (i > j) {
                    System.out.print("    ");
                } else {
                    System.out.print(i + "*" + j+" ");
                }
            }
            System.out.println();
        }

    }

    private static void f2() {
        for (int i = 0; i < 7; i++) {
            for (int j = 0; j <= i; j++) {
                System.out.print("*");
            }
            System.out.println();
        }
    }

    private static void f1() {
        //外层循环控制的是论述，内层循环控制的是本轮的次数
        //外层循环控制的是行数，内层循环控制的是每行的列数
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 5; j++) {
                if (i == 0 || i == 3) {
                    System.out.print("*" + " ");
                } else if (j == 0 || j == 4) {
                    System.out.print("*" + " ");
                } else {
                    System.out.print("  ");
                }
            }
            System.out.println("");
        }
        for (int i = 0; i < 6; i++) {
            for (int j = 0; j < 7; j++) {
                System.out.print("*");
            }
            System.out.println();
        }
    }
}
